package com.example.databindingdemo

import android.content.Intent
import android.os.Bundle
import android.widget.Toast
import androidx.appcompat.app.AppCompatActivity
import androidx.databinding.DataBindingUtil
import com.example.databindingdemo.databinding.ActivityNextBinding

class NextActivity : AppCompatActivity() {
    var userBean = UserBean("小红", 18)
    lateinit var binding: ActivityNextBinding
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        binding = DataBindingUtil.setContentView(this, R.layout.activity_next)
        binding.example = userBean
        binding.doing = Person()
    }

    inner class Person {
        fun onTextChanged(s: CharSequence, start: Int, before: Int, count: Int) {
            userBean.userName = s.toString()
            binding.example = userBean

        }

        fun onClickListenerBinding(userBean: UserBean) {
            startActivity(Intent(this@NextActivity, ThirdlyActivity::class.java))
        }
    }

}